<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>用户列表</title>
</head>
<body>
    <h3 align="center">用户列表</h3>
     <table border="1" cellspacing="0" align="center" width="30%">
         <tr>
             <th>编号</th>
             <th>姓名</th>
             <th>性别</th>
             <th>生日</th>
             <th>操作</th>
         </tr>
<#--freemarker循环标签，as后的变量为循环变量，等同于jsp foreach中的var-->
<#--u.birthday?string("yyyy-MM-dd"):将birthday使用string函数转换成符合格式的字符串-->
         <#list userPage.userList as u >
             <tr>
                 <td>${u.uid}</td>
                 <td>${u.name}</td>
                 <td>${u.sex}</td>
                 <td>${u.birthday?string("yyyy-MM-dd")}</td>
                 <td><a href="">修改</a> <a href="">删除</a></td>
             </tr>
         </#list>
     </table>
<div align="center" style="padding-top: 10px">
    <#if userPage.pageNum==1>
        首页 上一页
        <#else>
        <a href="/all_users?pageNum=1&pageSize=${userPage.pageSize}">首页</a>
            <a href="/all_users?pageNum=${userPage.pageNum-1}&pageSize=${userPage.pageSize}">上一页</a>
    </#if>

<#--    从1到pagecount循环，循环变量为i-->
    <#list 1..userPage.pageCount as i>
        <#if userPage.pageNum ==i>
            ${i}
            <#else>
            <a href="/all_users?pageNum=${i}&pageSize=${userPage.pageSize}">${i}</a>
        </#if>
    </#list>
    <#if userPage.pageNum == userPage.pageCount>
        下一页 末页
    <#else>
        <a href="/all_users?pageNum=${userPage.pageNum+1}&pageSize=${userPage.pageSize}">下一页</a>
        <a href="/all_users?pageNum=${userPage.pageCount}&pageSize=${userPage.pageSize}">末页</a>
    </#if>
</div>

</body>